﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FACUI.BasicClass
{
    public class GroupInfo
    {
        public string subType = "0";

        public string strName = "";

        private double _wav1 = 1525.0;
        public string strWav1
        {
            get { return _wav1.ToString(); }
            set
            {
                double _w = 0;
                double.TryParse(value, out _w);
                if ((_w > 1524) && (_w < 1571))
                {
                    _wav1 = _w;
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("输入数据不合法！");
                }
            }
        }

        private double _wav2 = 1570.0;
        public string strWav2
        {
            get { return _wav2.ToString(); }
            set
            {
                double _w = 0;
                double.TryParse(value, out _w);
                if ((_w > 1524) && (_w < 1571))
                {
                    _wav2 = _w;
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("输入数据不合法！");
                }
            }
        }
        public GroupInfo(string strDigt)
        {
            string[] strArray = strDigt.Split(',');
            strName = strArray[1];
            string[] strTmp = strArray[2].Split(';');
            subType = strTmp[0];
            strWav1 = strTmp[1];
            strWav2 = strTmp[2];
        }
        public GroupInfo(JYJ sharp)
        {
            subType = sharp.subType;
            strName = sharp.text;
        }

        public string toStringKgl()
        {
            StringBuilder builder = new StringBuilder("");
            builder.Append(this.strName).Append(",").Append(subType).Append(";").Append(strWav1).Append(";").Append(strWav2);
            return builder.ToString();
        }

    }
}
